//
//  KFDDateTests.m
//  
//
//  Created by JIRENTIANXIANG on 6/27/15.
//
//

#import "KFDDateTests.h"
#import "NSDate+range.h"

@implementation KFDDateTests

-(void)testIsPast
{
    NSDate* past=[NSDate dateWithTimeIntervalSinceNow:-10];
    NSDate* future=[NSDate dateWithTimeIntervalSinceNow:10];
    XCTAssert([past isPast]==YES);
    XCTAssert([future isPast]==NO);
    
}

-(void)testIsPastWithinOneMinute
{
    NSDate* date0=[NSDate dateWithTimeIntervalSinceNow:-59];
    XCTAssert([date0 isPastWithinOneMinute]);
    NSDate* date1=[NSDate dateWithTimeIntervalSinceNow:-61];
    XCTAssert(![date1 isPastWithinOneMinute]);
}

-(void)testIsPastWithinOneHour
{
    NSDate* date0=[NSDate dateWithTimeIntervalSinceNow:-3599];
    XCTAssert([date0 isPastWithinOneHour]);
    NSDate* date1=[NSDate dateWithTimeIntervalSinceNow:-3601];
    XCTAssert(![date1 isPastWithinOneHour]);
}

-(void)testIsPastWithinToday
{
    NSDate* date0=[NSDate date];
    XCTAssert([date0 isPastWithinToday]);
    NSDate* date1=[NSDate dateWithTimeIntervalSinceNow:-24*60*60];
    XCTAssert(![date1 isPastWithinToday]);
}

-(void)testIsWithinYesterday
{
    NSDate* date0=[NSDate dateWithTimeIntervalSinceNow:-24*60*60];
    XCTAssert([date0 isWithinYesterday]);
    NSDate* date1=[NSDate dateWithTimeIntervalSinceNow:-2*24*60*60];
    XCTAssert(![date1 isWithinYesterday]);
}

-(void)testIsWithinTheDayBeforeYesterday
{
    NSDate* date0=[NSDate dateWithTimeIntervalSinceNow:-2*24*60*60];
    XCTAssert([date0 isWithinTheDayBeforeYesterday]);
    NSDate* date1=[NSDate dateWithTimeIntervalSinceNow:-3*24*60*60];
    XCTAssert(![date1 isWithinTheDayBeforeYesterday]);
}

@end
